/*
 Navicat Premium Data Transfer

 Source Server         : mysql
 Source Server Type    : MySQL
 Source Server Version : 50718
 Source Host           : localhost
 Source Database       : test_oms

 Target Server Type    : MySQL
 Target Server Version : 50718
 File Encoding         : utf-8

 Date: 10/15/2019 17:23:41 PM
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `orders`
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `trade_id` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '交易号',
  `platform_id` bigint(20) DEFAULT NULL COMMENT '平台ID',
  `platform_code` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT '平台类型',
  `order_type` varchar(30) COLLATE utf8_bin DEFAULT NULL COMMENT '订单类型，数据字典ID',
  `store_id` bigint(20) DEFAULT NULL COMMENT '店铺ID',
  `store_code` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '店铺编码',
  `store_name` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '店铺名称',
  `trans_date` datetime DEFAULT '2000-01-01 00:00:00' COMMENT '交易日期',
  `pay_date` datetime DEFAULT NULL COMMENT '付款日期',
  `convert_date` datetime DEFAULT NULL COMMENT '转换日期',
  `buyer_message` varchar(1024) COLLATE utf8_bin DEFAULT NULL COMMENT '买家留言',
  `buyer_email` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '买家邮箱',
  `buyer_nick` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '买家昵称',
  `buyer_account` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '买家账号',
  `member_id` bigint(20) DEFAULT NULL COMMENT '会员ID',
  `price` decimal(20,5) DEFAULT '0.00000' COMMENT '价格',
  `payment` decimal(20,5) DEFAULT '0.00000' COMMENT '支付金额',
  `promotion` decimal(10,5) DEFAULT NULL COMMENT '促销金额',
  `is_manual` char(1) COLLATE utf8_bin DEFAULT '0' COMMENT '手工订单',
  `oms_order_status` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT 'oms中订单状态',
  `quantity` int(11) DEFAULT NULL COMMENT '商品总数量',
  `note` varchar(4172) COLLATE utf8_bin DEFAULT NULL COMMENT '内部便签',
  `audit_person` varchar(45) COLLATE utf8_bin DEFAULT NULL COMMENT '审核人',
  `audit_time` datetime DEFAULT NULL COMMENT '审核时间',
  `is_locked` char(255) COLLATE utf8_bin DEFAULT '0' COMMENT '是否锁定',
  `locker` varchar(10) COLLATE utf8_bin DEFAULT NULL COMMENT '锁定人',
  `created` datetime DEFAULT NULL COMMENT '创建时间',
  `modified` datetime DEFAULT NULL COMMENT '修改时间',
  `creater` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '创建人',
  `modifier` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT '修改人',
  `audit_status` varchar(20) COLLATE utf8_bin DEFAULT '0',
  `delivery_status` varchar(20) COLLATE utf8_bin DEFAULT '0',
  `delivery_date` datetime DEFAULT NULL,
  `is_intercept` varchar(2) COLLATE utf8_bin DEFAULT '0',
  `is_sendsms` varchar(2) COLLATE utf8_bin DEFAULT '0',
  `address` varchar(500) COLLATE utf8_bin DEFAULT NULL,
  `full_address` varchar(500) COLLATE utf8_bin DEFAULT NULL,
  `create_person` varchar(45) COLLATE utf8_bin DEFAULT NULL,
  `consignee` varchar(100) COLLATE utf8_bin DEFAULT NULL,
  `mobile` varchar(45) COLLATE utf8_bin DEFAULT NULL,
  `express_no` varchar(45) COLLATE utf8_bin DEFAULT NULL,
  `change_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'timestamp',
  PRIMARY KEY (`id`),
  KEY `idx_trade_id` (`trade_id`) USING BTREE,
  KEY `idx_pay_date` (`pay_date`) USING BTREE,
  KEY `idx_changeTime` (`change_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='订单';

-- ----------------------------
--  Records of `orders`
-- ----------------------------
BEGIN;
INSERT INTO `orders` VALUES ('1', '100010110111', '1', 'taobao', '1', '2', 'tb_bencaoqj', '天猫本草旗舰店', '2019-10-08 16:50:00', '2019-10-08 16:50:03', '2019-10-08 16:50:09', null, 'test@126.com', 'test', 'test123', '1', '150.00000', '150.00000', null, '0', '1', '2', null, null, '2019-10-08 16:58:11', '0', null, '2019-10-08 16:58:16', null, null, null, '1', '0', null, '0', '0', null, null, null, null, null, null, '2019-10-08 16:59:18');
COMMIT;

-- ----------------------------
--  Table structure for `orders_item`
-- ----------------------------
DROP TABLE IF EXISTS `orders_item`;
CREATE TABLE `orders_item` (
  `id` bigint(20) NOT NULL,
  `order_id` bigint(20) DEFAULT NULL COMMENT '订单ID',
  `first_cost` decimal(15,5) DEFAULT NULL COMMENT '一口价',
  `price_selling` decimal(15,5) DEFAULT NULL COMMENT '销售价',
  `discount_amount` decimal(15,5) DEFAULT NULL COMMENT '折扣数额',
  `amount_actual` decimal(20,5) DEFAULT NULL COMMENT '实付金额',
  `amount` decimal(15,5) DEFAULT NULL COMMENT '总金额',
  `discount_desc` varchar(300) COLLATE utf8_bin DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL COMMENT '数量',
  `is_deleted` char(1) COLLATE utf8_bin DEFAULT NULL COMMENT '是否行消',
  `is_out_of_stock` char(1) COLLATE utf8_bin DEFAULT NULL COMMENT '是否缺货',
  `product_name` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '本地商品名称',
  `product_code` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '本地商品货号',
  `bar_code` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '本地条形码',
  `is_virtual` char(1) COLLATE utf8_bin DEFAULT NULL COMMENT '是否虚拟商品',
  `is_pre_sale` char(1) COLLATE utf8_bin DEFAULT NULL COMMENT '是否预售商品',
  `is_gift` char(1) COLLATE utf8_bin DEFAULT NULL COMMENT '是否赠品',
  `promotion_code` varchar(50) COLLATE utf8_bin DEFAULT NULL COMMENT '活动编号',
  `brand_id` int(11) DEFAULT NULL COMMENT '品牌id',
  `brand_name` varchar(20) COLLATE utf8_bin DEFAULT NULL COMMENT '品牌名称',
  `status` char(20) COLLATE utf8_bin DEFAULT NULL COMMENT '状态',
  `change_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'ʱ',
  PRIMARY KEY (`id`),
  KEY `fk_fk_order_detail` (`order_id`),
  KEY `is_deleted` (`is_deleted`),
  KEY `idx_product_code` (`product_code`),
  KEY `dix_sys_barcode` (`bar_code`),
  KEY `idx_sys_product_code` (`product_code`),
  CONSTRAINT `orders_item_ibfk_1` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin ROW_FORMAT=COMPACT COMMENT='订单_明细';

-- ----------------------------
--  Records of `orders_item`
-- ----------------------------
BEGIN;
INSERT INTO `orders_item` VALUES ('1', '1', '200.00000', '100.00000', '0.00000', '100.00000', '100.00000', null, '1', null, null, '胎菊', 'DJ0001', 'DJ000101', null, null, null, null, '1', '本草', '1', '2019-10-08 17:19:07'), ('2', '1', '500.00000', '360.00000', '20.00000', '340.00000', '360.00000', null, '2', null, null, '雪菊', 'DJ0002', 'DJ000201', null, null, null, null, '1', '本草', '1', '2019-10-08 17:19:18');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
